home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / network / daemons / nfs / nfs-serv.2be / nfs-serv / nfs-server-2.2beta16 / nfsmounted.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-10-14  |  1.6 KB  |  74 lines

  1. /*
  2.  * nfs_mounted.c -- determine if a pathname has been NFS mounted
  3.  * Copyright (C) 1993 Rick Sladkey <jrs@world.std.com>
  4.  *
  5.  * This program is free software; you can redistribute it and/or modify
  6.  * it under the terms of the GNU Library Public License as published by
  7.  * the Free Software Foundation; either version 2, or (at your option)
  8.  * any later version.
  9.  *
  10.  * This program is distributed in the hope that it will be useful,
  11.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.  * GNU Library Public License for more details.
  14.  */
  15.  
  16. #ifdef HAVE_CONFIG_H
  17. #include <config.h>
  18. #endif
  19.  
  20. #include <sys/types.h>
  21. #if defined(HAVE_UNISTD_H) || defined(STDC_HEADERS)
  22. #include <unistd.h>
  23. #endif
  24. #include <stdio.h>
  25. #ifdef HAVE_STRING_H
  26. #include <string.h>
  27. #else
  28. #include <strings.h>
  29. #endif
  30. #ifdef _POSIX_VERSION
  31. #include <limits.h>            /* for PATH_MAX */
  32. #else
  33. #include <sys/param.h>            /* for MAXPATHLEN */
  34. #endif
  35. #include <errno.h>
  36. #ifndef STDC_HEADERS
  37. extern int errno;
  38. #endif
  39.  
  40. #include <sys/stat.h>            /* for S_IFLNK */
  41.  
  42. #ifndef PATH_MAX
  43. #ifdef _POSIX_VERSION
  44. #define PATH_MAX _POSIX_PATH_MAX
  45. #else
  46. #ifdef MAXPATHLEN
  47. #define PATH_MAX MAXPATHLEN
  48. #else
  49. #define PATH_MAX 1024
  50. #endif
  51. #endif
  52. #endif
  53.  
  54. #ifdef MAJOR_IN_MKDEV
  55. #include <sys/mkdev.h>
  56. #endif
  57. #ifdef MAJOR_IN_SYSMACROS
  58. #include <sys/sysmacros.h>
  59. #endif
  60.  
  61. #ifdef __STDC__
  62. int nfsmounted(const char *path, struct stat *sbp)
  63. #else
  64. int nfsmounted(path, sbp)
  65. const char *path;
  66. struct stat *sbp;
  67. #endif
  68. {
  69. #ifdef __linux__
  70.     return major(sbp->st_dev) == 0;
  71. #endif
  72.     return 0;
  73. }
  74.